<?
include("../header.php");
include("../lib/config.php");

$op		= $HTTP_GET_VARS['op'];
$nik	= $HTTP_GET_VARS['nik'];
$no		= $HTTP_GET_VARS['no'];

if($op == "edit"){
	$query		= mssql_query("WITH W AS (SELECT ROW_NUMBER() OVER(ORDER BY NIK) AS No, * FROM S_File_Emp WHERE NIK='$nik') SELECT * FROM W WHERE No='$no'",$conn);
	$row		= mssql_fetch_array($query);
	$action 	= "../lib/update.php";
	$VButton	= "Update";
}
else{
	$action 	= "../lib/save.php";
	$VButton	= "Save";
}

?>
<script type="text/javascript" language="javascript">

	function Validate(){
		if(document.FEmployee.nama.value == "")
		{
			alert("Field : Nama Dokumen tidak boleh kosong ...");
			document.FEmployee.nama.focus();
			return false;
		}
				
		document.FEmployee.submit();

	}
	
</script>
</head>
<form name="FEmployee" enctype="multipart/form-data" method="post" action="<?=$action?>">
<table width="100%" class="no_border">
 <tr>
  <td colspan="2">
	<table width="100%" style="border:none;">
	<tr>
	 <td colspan="2" class="line_bottom">&nbsp;&nbsp;<b>UPLOAD DOKUMEN</b></td>
	</tr>
	</table>
  </td>
  </td>
 </tr>
 <tr>
  <td>&nbsp;</td>
 </tr>
 <tr>
  <td>
 &nbsp;&nbsp;&nbsp;Upload dokumen pegawai seperti hasil scan ijazah. (<span style="color:#990000;">maksimal ukuran file: 2MB</span>)<br /><br />
 <table style="position:relative; left:80px;" cellpadding="1" cellspacing="0">
 <tr>
  <td>Nama Dokumen:</td>
  <td><input type="text" name="nama" value="<?=$row[nama_file]?>" size="50" maxlength="50" /></td>
 </tr>
<?
	if($op == "edit"){
	}
	else{
?>
 <tr>
  <td>Upload Dokumen:</td>
  <td><input type="file" name="file" /></td>
 </tr>
<?
	}
?>
 <tr>
  <td>&nbsp;</td>
  <td align="left"><br />
  <input type="hidden" name="cat" value="upload_file" />
  <input type="hidden" name="no" value="<?=$no?>" />
  <input type="hidden" name="nik" value="<?=$HTTP_GET_VARS['nik']?>" />
  <input type="button" value="Cancel" class="button" onclick="Javascript:history.back();" /><input type="button" value="<?=$VButton?>" class="button" onclick="Validate();"/>
  <br /><br />
  </td>
 </tr>
</table>
</form>
</td>
</tr>
<tr>
 <td colspan="2" style="border:none;"><? include("../footer.php"); ?></td>
</tr>
</table>
</body>
</html>
<script type="text/javascript">

//var f = document.forms[0];
//MaskInput(f.code,"9999");
//]]>
</script>
<?
echo"</div>
	  </td>
	   </tr>
	    </table>
";
include("../menu.php");
?>
